package com.mall.group_booking.controller;

import com.mall.entity.groupbooking.GbRecord;
import com.mall.group_booking.service.BookingRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author White
 * @version 1.0
 * @email 616769721@qq.com
 * @date 2021/7/29 20:25
 */
@RestController
@RequestMapping("/bookingRecord")
@CrossOrigin
public class BookingRecordController {

    @Autowired
    private BookingRecordService bookingRecordService;

    /**
     * 查询指定用户下正在拼团的记录
     * @param rootId
     * @return
     */
    @GetMapping("/findRecordByRootId/{rootId}")
    public List<GbRecord> findRecordByRootId(
            @PathVariable Integer rootId){
        return bookingRecordService.findRecordByRootId(rootId);
    }

    @PostMapping("/recordToMysql")
    public void recordToMysql(@RequestParam("recordId") Long recordId){
        bookingRecordService.recordToMysql(recordId);
    }

}
